
public class ResourceUsageData implements IResourceUsageData
{
	private Double powerAverage = new Double(0.0);
	private Double resourceCapability = new Double(1.0);
	private int internalCounter = 0;
	
	public ResourceUsageData(Double pA, Double rC)
	{
		powerAverage = pA;
		resourceCapability = rC;
		internalCounter = 1;
	}
	
	public Double getPowerAverage()
	{
		return powerAverage;
	}
	
	public Double getResourceCapability()
	{
		return resourceCapability;
	}
	
	public void adjustPowerAverage(Double newPowerConsumption)
	{
		Double prevPowerAverage = powerAverage;
		powerAverage = ((powerAverage*internalCounter) + newPowerConsumption)/(++internalCounter);
		
		setResourceCapability(prevPowerAverage,powerAverage);
	}
	
	private void setResourceCapability(Double prevPA, Double newPA)
	{
		resourceCapability = newPA/prevPA;
	}
}
